package com.gome.TestUtil.set;

import java.util.HashSet;  
import java.util.Iterator;  
import java.util.Set;  
  
/**
 * set 遍历

 *   

 *  

 * @author tx_hemaojie    

 * @version 1.0  

 * @created 2013-7-9 上午10:56:55
 */

public class SetBianli {  
    public static void main(String[] args) {  
        SetBianli ss=new SetBianli();  
          
        Set set=new HashSet();  
          
        Person p1=new Person("p1",1);  
        Person p2=new Person("p2",2);  
        Person p3=new Person("p3",3);  
          
        set.add(p1);  
        set.add(p2);  
        set.add(p3);  
          
        Iterator it=set.iterator();  
        while(it.hasNext()){  
            Person p=(Person)it.next();  
            System.out.println(p.toString());  
        }  
          
    }  
  
}  